﻿<?php
/* Template Name: 友情链接
 * Author: Cleris
 */

get_header();

//导航菜单
	$custom_fields = get_post_custom_keys($post_id);
	if( !in_array( 'pgmenu', $custom_fields) ){
		$pgmenu = 1;
	}
?>
	<div class="hide"><?php ini_map()?></div>
	<div class="main-page" <?php if( $pgmenu!==1 ) echo 'style="padding:20px 25px"'?>>
		<?php if( $pgmenu==1 && !ismobile() ) wp_nav_menu( array('theme_location' => 'pagemenu', 'class' => 'pg-menu') )?>
		<h2 class="entry-title"><?php the_title()?></h2>
<?php while (have_posts()) : the_post()?>
		<span><?php edit_post_link('编辑文章','<i class="icon-edit"></i> ')?></span>
		<p class="excerpt hide"><?php bloginfo('name')?>的友情链接</p>
		<div class="context" property="v:description"><?php the_content()?></div>
		<?php ini_bdshare()?> 
		<ul class="flink clear">
<?php
$bookmarks = get_bookmarks('orderby=id&title_li=&categorize=');
if(!empty($bookmarks)){
	foreach ($bookmarks as $bookmark) {
		$booktitle = ismobile()? '': 'title="'.$bookmark->link_description.'"';
		$output.= "			<li class'slow'><a href=".$bookmark->link_url." $booktitle rel='external'><i>".$bookmark->link_name."</i><span>".mb_strimwidth( strip_tags( $bookmark->link_description ), 0, 60, "...")."</span></a></li>\n";
	}
	echo $output;
}
?>
		</ul>
<?php if('open'== $post->comment_status) comments_template()?>
<?php endwhile?>
	</div>
<script type="text/javascript">
	jQuery(document).ready(function($){
		$(".flink a").each(function(e){
			$(this).prepend('<img src=http://www.google.com/s2/favicons?domain='+this.href.replace(/^(http:\/\/[^\/]+).*$/, '$1').replace('http://','')+' style="float:left;padding:3px 8px 0 0" alt="favicon">');
		}); 
	});
</script>
<?php get_footer()?>